package cn.wx.scholar.neo4j.repository;

import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.data.neo4j.annotation.Query;
import org.springframework.data.neo4j.repository.Neo4jRepository;
/*import org.springframework.data.neo4j.repository.GraphRepository;*/
import org.springframework.data.repository.query.Param;
import org.springframework.stereotype.Repository;

import cn.wx.scholar.neo4j.entity.Neo4jNews;

@Repository
public interface NewsRepository extends Neo4jRepository<Neo4jNews,Long>  {


	@Query(value = "match(e:expert)-[r:about]-(n:news) where ID(e)={exportId} return n order by n.orderByTitle desc,n.pubTime desc",
			countQuery = " match(e:expert)-[r:about]-(n:news) where ID(e)={exportId} return count(*) "
	)
	Page<Neo4jNews> findAllNewsById(@Param("exportId") Long exportId,@Param("exportName") String exportName,Pageable pageable);	//查询某个专家相关的所有新闻，带分页

	@Query("match(n:news) where ID(n)={id} return n")
	Neo4jNews findNewsDetailById(@Param("id") Long id);	//查询某篇新闻的详情
}
